fix(#1931): show user-friendly warning when answerOption terminology lookup fails - #2000
Open
MaryamMehd wants to merge 6 commits into
Open
fix(#1931): show user-friendly warning when answerOption terminology lookup fails#2000MaryamMehd wants to merge 6 commits into
MaryamMehd wants to merge 6 commits into
Conversation
…linkId Switch answerOptionsLookupFailures from tracking linkIds to individual coding keys (system|code). The dropdown now stays accessible and shows a bracketed code fallback (e.g. [133932002]) for each option that could not be resolved, with a single amber warning below the field for partial failures — keeping successfully-resolved options fully labelled. Co-authored-by: Cursor <cursoragent@cursor.com>
MaryamMehd
marked this pull request as ready for review
July 20, 2026 04:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1931
When a questionnaire has
answerOptioncodings withoutdisplayvalues, the renderer callsCodeSystem/$lookupto fetch human-readable labels. If the terminology server is unavailable, the lookups silently fail and the UI displays raw SNOMED codes — confusing for end users.Changes:
addDisplayToAnswerOptionsnow returns alookupFailedCodingKeys: Set<string>(keyed bysystem|code) alongside the resolved options, tracking failed lookups at the individual coding level.answerOptionsLookupFailuresis threaded throughQuestionnaireModel,QuestionnaireStoreType, anduseQuestionnaireStoreso field components can detect which specific options could not be resolved.ChoiceSelectAnswerOptionFieldsandOpenChoiceSelectAnswerOptionFieldnow filter out unresolvable options from the dropdown (so no raw codes are shown) and display an amber helper text: "Some items in this list were not able to be displayed".addDisplayToCodings.test.tsupdated to assertlookupFailedCodingKeysis correctly populated.Before / After
133932002,394738000) shown in dropdown ❌Test plan
cd packages/smart-forms-renderer && npx jest --testPathPattern="addDisplayToCodings"— all tests pass.answerOptioncodings that have nodisplay, set the terminology server to a URL that validates but lacks SNOMED (e.g.https://hapi.fhir.org/baseR4), build the form — affected options are hidden and the amber warning appears.